<extend name="Layout:community" />
<block name="title">{$community['title']}详情-</block>
<block name="head">
    <link rel="stylesheet" type="text/css" href="{:asset('css/home/community.css')}">
</block>

<block name="content">
    <div class="container">
        <div class="row">
            <?php $active = '小区详情'; ?>
            <include file="_nav"/>
            <div class="clearfix mb20">
                <div class="community-left-block pull-left community-detail mr20">
                    <h3 class="tab-title">{$community['title']}</h3>
                    <div class="community-introduce clearfix">
                        <a href="{:url('community/' . $community['id'] . '/album')}"><img src="<?php echo thumb($community['cover'], 100, 75); ?>" class="thumbnail" width="100px" height="75px"/></a>
                        <p class="pull-left"><?php echo msubstr(strip_tags($community['content']), 0, 150); ?></p>
                    </div>
                    <dl class="infomenu clearfix">
                        <dt><strong>目录</strong></dt>
                        <dd><a href="#base-info">基本信息</a></dd>
                        <dd><a href="#equipment">配套设施</a></dd>
                        <dd><a href="#summary">小区简介</a></dd>
                        <dd><a href="#traffic">交通状况</a></dd>
                        <dd><a href="#around">周边信息</a></dd>
                        <dd><a href="#map">地理位置</a></dd>
                    </dl>
                    <h3 class="tab-title" id="base-info">基本信息</h3>
                    <div class="community-info">
                        <table class="base-info-table">
                            <tr>
                                <td><strong>所在区域：</strong>{$community['region']}</td>
                                <td><strong>楼栋总数：</strong>{$community['building_num']}</td>
                            </tr>
                            <tr>
                                <td><strong>建筑年代：</strong>{:date('Y-m-d', strtotime($community['complete_date']))}</td>
                                <td><strong>占地面积：</strong>{$community['floor_area']}平方米</td>
                            </tr>
                            <tr>
                                <td><strong>物业类型：</strong>{$community['property_type']}</td>
                                <td><strong>容 积 率：</strong>{$community['rjl']}</td>
                            </tr>
                            <tr>
                                <td><strong>开 发 商：</strong>{$community['developer']}</td>
                                <td><strong>绿 化 率：</strong>{$community['lhl']}</td>
                            </tr>
                            <tr>
                                <td><strong>物业公司：</strong>{$community['property_corportion']}</td>
                                <td><strong>物 业 费：</strong>{$community['property_fee']}元/平米·月</td>
                            </tr>
                            <tr>
                                <td><strong>小区地址：</strong>{$community['address']}</td>
                                <td><strong>物业类型：</strong>{$community['property_type']}</td>
                            </tr>
                            <tr>
                                <td><strong>建筑面积：</strong>{$community['area']}(㎡)</td>
                                <td><strong>开 发 商：</strong>{$community['developer']}</td>
                            </tr>
                            <tr>
                                <td><strong>建筑类别：</strong>{:trim($community['construction_type'], ',')}</td>
                                <td><strong>均价：</strong>{$community['price']}</td>
                            </tr>
                            <tr>
                                <td><strong>楼栋总数：</strong>{$community['building_num']}</td>
                                <td><strong>供水：</strong>{$community['water']}</td>
                            </tr>

                        </table>
                    </div>
                    <h3 class="tab-title" id="equipment">配套设施</h3>
                    <div class="community-equipment">
                        <table class="base-info-table">
                            <tr>
                                <td><strong>供电：</strong>{$community['electricity']}</td>
                                <td><strong>燃气：</strong>{$community['gas']}</td>
                            </tr>
                            <tr>
                                <td><strong>通讯设备：</strong>{$community['communication']}</td>
                                <td><strong>停车位：</strong>{$community['park']}</td>
                            </tr>
                        </table>
                    </div>
                    <h3 class="tab-title" id="summary">小区简介</h3>
                    <div class="community-summary">
                        <?php echo $community['content']; ?>
                    </div>
                    <h3 class="tab-title" id="traffic">交通状况</h3>
                    <div class="community-traffic">
                        <?php echo $community['traffic']; ?>
                    </div>
                    <h3 class="tab-title" id="around">周边信息</h3>
                    <div class="community-info">
                        <?php echo $community['around']; ?>
                    </div>
                    <h3 class="tab-title" id="map">地理位置</h3>
                    <div class="community-info">
                        <div class="map" id="map">
                            <h5 class="map-tab"><span class="active">百度地图</span></h5>
                            <div class="map-tab-pane map-content">
                                <div id="js-community_map">
                                    <?php if(empty($community['map'])) {echo '<p class="text-center">暂无地图信息</p>'; } ?>
                                </div>
                            </div>
                            <div class="js-map-info">
                                <div class="map-tab clearfix">
                                    <span class="active" data-keywords="公交$地铁">交通</span>
                                    <span data-keywords="学校">学校</span>
                                    <span data-keywords="医院">医疗</span>
                                    <span data-keywords="餐饮">餐饮</span>
                                    <span data-keywords="超市$商场">购物</span>
                                </div>
                                <div class="map-tab-pane" id="js-map-query-result"></div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="community-right-block pull-right">
                    <div class="community-relation-post mb10">
                        <h3 class="tab-title">相关文章</h3>
                        <div class="relation-posts">
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</block>
<block name="footer-script">
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=1uWFbCYO6wyXHHODQIgGabyi"></script>
    <script type="text/javascript" src="{:asset('js/home/map.js')}"></script>
    <script type="text/javascript" src="{:asset('js/common/community.js')}"></script>
    <script type="text/javascript">
        $(window).load(function() {
            <?php if ($community['map']) { ?>
                // 百度地图API功能
                var map = new BMap.Map("js-community_map",{minZoom:4,maxZoom:15});
                <?php list($longitude , $latitude) = split(',', $community['map']); ?>
                var default_point = new BMap.Point(<?php echo $longitude; ?>, <?php echo $latitude; ?>);
                map.centerAndZoom(default_point, 15);
                // var marker = new BMap.Marker(default_point);
                // marker.setLabel(new BMap.Label("<?php echo $community['title']; ?>",{offset:new BMap.Size(20,-10)}));
                // map.addOverlay(marker);
                // 添加负载覆盖物
                var myCompOverlay = new ComplexCustomOverlay(default_point, "<?php echo $community['title']; ?>","<?php echo $community['title']; ?>");
                map.addOverlay(myCompOverlay);

                map.addControl(new BMap.NavigationControl({anchor: BMAP_ANCHOR_TOP_RIGHT}));

                var custom_map = new MapOP(map, {ak: '1uWFbCYO6wyXHHODQIgGabyi',location: '<?php echo $latitude . ',' . $longitude; ?>'});
                $('.js-map-info span').click(function(e) {
                    e.preventDefault();
                    var _this = $(this);
                    _this.addClass('active').siblings('.active').removeClass('active');
                    custom_map.query('#js-map-query-result', _this.data('keywords'));
                });
                custom_map.query('#js-map-query-result', '公交$地铁');
            <?php } ?>
        });
    </script>
</block>